<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>欢迎来到 Sams Blog.</title>
<link rel="Stylesheet" type="text/css" href='Content/base.css' />
<link rel="Stylesheet" type="text/css" href='Content/index.css' />
<script type="text/javascript"
	src="${pageContext.request.contextPath }/script/jquery-1.10.2.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/script/jquery.validate.js"></script>
<script type="text/javascript">
	$(function() {
		$("#form").validate({
			rules : {
				username : {
					required : true
				},
				password : {
					required : true
				}
			},
			messages : {
				username : {
					required : "请输入用户名"
				},
				password : {
					required : "请输入密码"
				}
			}
		});
	});
</script>
<style type="text/css">
.article-title a {
	font-weight: bold;
}

#hotAuthors, #newArticles a {
	font-size: 18px;
}

label.error {
	color: red;
	display: block;
}
</style>
</head>
<body>
	<div id="wrapper">
		<div id="header">
			<img id="header-logo" src="Content/images/logo.jpg" alt="blog-logo" />
		</div>
		<div id="content">
			<div id="sideBar">
				<div id="sideBar-login">
					<c:if test="${empty user }">
						<form action="register" id="form">
							<fieldset>
								<div>
									<label class="title">用户名：</label><input class="txt" type="text"
										id="username" name="username" />
								</div>
								<div class="clearBoth">
									<label class="title">密码：</label><input class="txt"
										type="password" id="password" name="password" />
								</div>
								<c:if test="${not empty msg }">
									<label class="error">${msg }</label>
								</c:if>
								<div class="clearBoth">
									<input type="submit" id="btnLogin" name="btnLogin" value="" />
									<a href="#" id="btnRegister"></a>
								</div>
							</fieldset>
						</form>
					</c:if>
					<label class="login-error"></label>
					<c:if test="${not empty user }">
						<div id="function-panel">
							<h3>欢迎回来，${user.nickname }</h3>
							<ul>
								<li><a href="manage">去维护我的博客和相册</a></li>
								<li><a href="#">维护个人资料</a></li>
								<li><a href="logoff">注销登录</a></li>
							</ul>
						</div>
					</c:if>
				</div>
				<div class="sideBar-block">
					<h3 class="sideBar-block-title">最新博文</h3>
					<div id="newArticles" class="sideBar-block-body">
						<ul>
							<c:forEach items="${articleUpdate }" var="a">
								<li><a
									href="articleDetail?articleId=${a.id }&userId=${a.user.id}">${a.title }</a></li>
							</c:forEach>
						</ul>
					</div>
				</div>
				<div class="sideBar-block">
					<h3 class="sideBar-block-title">热门博主</h3>
					<div id="hotAuthors" class="sideBar-block-body">
						<ul>
							<c:forEach var="u" items="${hotUser }">
								<li><a href="blog?userId=${u.id }">${u.nickname }</a></li>
							</c:forEach>
						</ul>
					</div>
				</div>
			</div>
			<div id="main">
				<div>
					<img src="Content/images/index-ad.gif" alt="" />
				</div>
				<div id="hotArticles">
					<h3>热门博文</h3>
					<div class="linedot"></div>
					<c:forEach items="${articleClicks }" var="a">
						<table class="article">
							<tr>
								<td rowspan="3" class="article-author"><img
									src="${pageContext.request.contextPath }/UserFiles/UserHeads/${a.user.id}.jpg" />
								</td>
								<td class="article-title"><a
									href="articleDetail?articleId=${a.id }&userId=${a.user.id}">${a.title }</a></td>
							</tr>
							<tr>
								<td class="article-body">${a.contentInfo }</td>
							</tr>
							<tr>
								<td class="article-link"><a
									href="articleDetail?articleId=${a.id }&userId=${a.user.id}">查看全文>></a></td>
							</tr>
						</table>
						<div class="linedot"></div>
					</c:forEach>
				</div>
			</div>
			<div class="clearBoth"></div>
		</div>
		<div id="footer">
			<p>媒体报道 | 关于我们 | 工作机会 | 相关法律 | 广告服务 | Bus小店 | 申请博客 | 网站地图 | 合作伙伴
			</p>
			<p>© 2002 - 2011 SamsBlog.com, All Rights Reserved. Sams Blog
				版权所有 粤ICP B2-20080056号</p>
		</div>
	</div>
</body>
</html>
